#ifndef SERVER_H
#define SERVER_H

#include <QTcpServer>

#include <QtXml/QDomDocument>
#include <QtXml/QDomElement>
#include <QtXml/QDomNode>
#include <QtXml/QDomNodeList>

#include "clientthread.h"
#include "global.h"

class Server : public QTcpServer
{
    Q_OBJECT
public:
    explicit Server(QObject *parent = 0);

signals:
    void NewConnection(QString uid,QString nickname,QString ip,int port);
    void DisConnection(QString uid,QString nickname,QString ip,int port);
    void serverClose();

public slots:
    void processNewConnection(QString uid,QString nickname,QString ip,int port);

private:
    void incomingConnection(int socketId);

private:
    QDomDocument m_userList;  ///is a DOM,to hold the client list
    QDomElement  m_root;      ///DOM's root

};

#endif // SERVER_H
